/*
* Nom de classe : Itinerary
*
* Description   : Lieu
*
* Version       : 0.0
*
* Date          : 31/01/2014
*
* Update     	: Julian
*/
package org.exia.minisig.model.object;

import java.awt.Image;
import java.util.ArrayList;
import java.util.Iterator;

import org.exia.minisig.application.Utils;
import org.exia.minisig.model.dao.InterestDAO;
import org.exia.minisig.services.InterestManager;
import org.exia.minisig.services.PlaceManager;
import org.exia.minisig.swing.controller.GUIManager;


/**
* Place - lieu
* - Lieu a afficher
*
* @version0.0
* @date 31/01/2013
*/
public class Place extends DescriptibleElement {
	private String date;
	private Image Map;
	private ArrayList<Interest> interests;
	public ArrayList<Interest> getInterests() {
		InterestDAO interest = new InterestDAO(this.getId());
		interests = new ArrayList<>();
		for (Interest x: interest.selectFromMap()) {
			interests.add(x);
		}
		return interests;
	}
	public void setInterests(ArrayList<Interest> interests) {
		this.interests = interests;
	}
	//CONSTRUCTOR
	public Place(){
		initializeVar();
		
	}
	public void initializeVar(){
		interests = new ArrayList<>();
	}
	public String getDate(){
		return date;
	}
	public Image getMap(){
		if (this.getImages().size() < 1){
			javax.swing.JOptionPane.showMessageDialog(null,"Vous devez definir une image pour un lieu."); 
			GUIManager.getInstance().runHome();
			return null;
		} else {
			if (this.Map == null){
				Map = Utils.loadImage(this.getImages().get(0));
			}
			return this.Map;
		}
	}
}
